<?php namespace App\Http\Controllers;

use App\Models\ShopCar as MShopCar;
use Illuminate\Http\Request;

class ShopCar extends Controller
{

    //编辑购物车商品
    public function update(Request $request, $id)
    {
        $shop_car = MShopCar::find($id);
        assert($shop_car);
        $shop_car->number = $request->input('number');
        $shop_car->money = $request->input('money');
        $shop_car->save();
        return response()->json($shop_car->id);
    }

    //删除购物车商品
    public function destroy($id)
    {
        $shop_car = MShopCar::find($id);
        assert($shop_car);
        MShopCar::destroy($id);
        return response('ok', 200);
    }
}
